﻿<Window 
    x:Class="Bindable.Linq.Samples.PizzaHaven.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:binders="clr-namespace:Bindable.Linq.Samples.PizzaHaven.Binders"
    xmlns:domain="clr-namespace:Bindable.Linq.Samples.PizzaHaven.Domain"
    Title="Pizza Haven" Height="477" Width="770"
    FontSize="12pt"
    >
    <Window.Resources>
        <DataTemplate DataType="{x:Type binders:SelectableTopping}">
            <Border Padding="5">
                <StackPanel Orientation="Horizontal">
                    <CheckBox IsChecked="{Binding Path=IsSelected}" />
                    <Label Content="{Binding Path=Topping.Name}" />
                </StackPanel>
            </Border>
        </DataTemplate>

        <DataTemplate DataType="{x:Type domain:Topping}">
            <Border Padding="5">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <Label Content="{Binding Path=Name}" />
                    <Label Content="{Binding Path=Price}" HorizontalContentAlignment="Right" />
                </Grid>
            </Border>
        </DataTemplate>
    </Window.Resources>
    <DockPanel>
        <Border DockPanel.Dock="Bottom" Background="Yellow">
            <TextBlock Text="{Binding Path=HealthWarningMessage.Current}" />
        </Border>
        
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="3*" />
                <ColumnDefinition Width="1*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" MinHeight="26" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Label>Select your toppings:</Label>
            <Label Grid.Column="1">Summary</Label>

            <ListBox ItemsSource="{Binding Path=AvailableToppings}" Grid.Row="1" />
            
            <StackPanel Grid.Column="1" Grid.Row="1">
                <ItemsControl ItemsSource="{Binding Path=SelectedToppings}" />
                <Label Content="{Binding Path=TotalPrice.Current}"></Label>
            </StackPanel>
        </Grid>
    </DockPanel>
</Window>
